package lab01;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/9/30.
 */
public class Test12 {
      public static void main(String[] args) {
        System.out.println("请输入一个1到9999的数：");
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        int units, tens, hundreds, thousands;
        int count = 1;
        int a = 0;
        units = num % 10;
        tens = (num %100)/10;
        hundreds = (num %1000)/100;
        thousands = num / 1000;
        if (thousands != 0) {
            count = 4;
            a = units * 1000 + tens *100 + hundreds * 10 + thousands *1;
        } else if (hundreds != 0) {
            count = 3;
            a = units *100 + tens * 10 + hundreds *1;
        } else if (tens != 0) {
            count = 2;
            a =  units* 10 + tens*1;
        } else {
            count = 1;
            System.out.println(num + "是回文数");
        }
        System.out.println(num + "是" + count + "位数");
        if (num == a){
            System.out.println(num+"是回文数！");
        }else{
            System.out.println(num+"不是回文数！");
        }
        System.out.println(num +"千位是" + thousands + "百位是" + hundreds + "十位是" + tens + "个位是" + units);
    }
}
